/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades_Persistencia;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author erikasv
 */
@Entity
@Table(name = "nivel_estudios")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NivelEstudios.findAll", query = "SELECT n FROM NivelEstudios n"),
    @NamedQuery(name = "NivelEstudios.findByCodigo", query = "SELECT n FROM NivelEstudios n WHERE n.codigo = :codigo"),
    @NamedQuery(name = "NivelEstudios.findByNivel", query = "SELECT n FROM NivelEstudios n WHERE n.nivel = :nivel")})
public class NivelEstudios implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Basic(optional = false)
//    @NotNull
    @Column(name = "codigo")
    private Integer codigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nivel")
    private String nivel;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codigoNivelEstudios")
    private List<Evaluador> evaluadorList;

    public NivelEstudios() {
    }

    public NivelEstudios(Integer codigo) {
        this.codigo = codigo;
    }

    public NivelEstudios(Integer codigo, String nivel) {
        this.codigo = codigo;
        this.nivel = nivel;
    }

    public Integer getCodigo() {
        return codigo;
    }

    public void setCodigo(Integer codigo) {
        this.codigo = codigo;
    }

    public String getNivel() {
        return nivel;
    }

    public void setNivel(String nivel) {
        this.nivel = nivel;
    }

    @XmlTransient
    public List<Evaluador> getEvaluadorList() {
        return evaluadorList;
    }

    public void setEvaluadorList(List<Evaluador> evaluadorList) {
        this.evaluadorList = evaluadorList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NivelEstudios)) {
            return false;
        }
        NivelEstudios other = (NivelEstudios) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nivel;
    }
    
}
